<template>
    <div id="pwd">
        <el-input show-password v-model="upForm.passWord" placeholder="请输入当前密码"></el-input>
        <br><br>
        <el-input show-password v-model="upForm.newPassword" placeholder="输入新密码"></el-input>
        <br><br>
        <el-input show-password v-model="upForm.rePassword" placeholder="再输入一次">

        </el-input>
        <br><br>
        <el-button style="width: 100%" type="primary" @click="submit()">提交</el-button>
    </div>


</template>

<script>
    import {pwdChange} from "../../network/admin"
    export default {
        name:'pwdChange',
        data(){
            return{
                upForm:{
                    passWord:'',
                    newPassword:'',
                    rePassword:''
                }

            }
        },
        methods:{
            submit(){
                console.log(this.upForm);
                pwdChange(this.upForm)
                    .then(res=>{
                        console.log(res);
                        if(res.data.extend.msg=='修改成功'){
                            this.$message.success(res.data.extend.msg)
                            this.$router.push("/login")
                        }else {
                          this.$message.warning(res.data.extend.msg)
                        }
                    })
            }
        }
    }
</script>

<style>
    #pwd{
        width: 40%;
        margin: 120px auto;
    }
</style>
